package com.shg.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import org.compass.annotations.Index;
import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableComponent;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;
import org.compass.annotations.Store;

import com.shg.bean.bbs.Forum;
/**
 * @author Administrator
 *书籍相关属性
 *把该类声明为搜索实体
 */
@Searchable
public class Book implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	//书籍id编码
	//搜索实体必须具备的一个标识属性ID
	@SearchableId
	private String id;
	//书籍名称
	//把该属性设置为索引字段,boost表示的级别，默认是1，数字越大，级别越高
	@SearchableProperty(boost=2,name="bookName")
	private String bookName;
	//书籍Logo
	private String logo;
	//
	@SearchableProperty(index=Index.NO,store=Store.YES)
	private String logo_300;
	//书籍价格
	@SearchableProperty(index=Index.NO,store=Store.YES)
	private double price;
	//积分
	private double integral=0;
	//书籍的页数
	private Integer page;
	//书籍描述	
	//默认是需要分词，需要索引，并存储在里面
	@SearchableProperty(name="description")
	private String description;
	//书籍上下架(1.上架、2.待审核，3.删除的书籍 ，4、问题书籍)
	private Integer show=2;
	//推荐的书籍1 、表示推荐 0 、表示没有推荐
	private int recommend=0;
	//书籍所属父类
	@SearchableComponent
	private BookType parent;
	//当前这本书日期
	private Date dateLine=new Date();
	//书籍的所属出版社
	private String print;
	//书籍的ISBN
	private String isbn;
	//书籍类型 1：收费 0：免费
	@SearchableProperty(name="type",index=Index.NOT_ANALYZED,store=Store.YES)
	private Integer type;
	//书籍文件路径
	private String path;
	//该书籍所在店铺
	@SearchableComponent
	private Shop shop;
	//书籍的统计记录
	private Long record;
	//销售出去的书籍(订单列表)
	private Set<SoldBook> soldBooks;
	//被收藏的书籍(受欢迎的书籍)
	private Integer	 love=0;
	//书籍的评价（用户买真本书后有机会这这本书籍一个好评）
	//书籍的论坛分享（买这本书籍后可以分享一下自己书籍的读后感）
	private Set<Forum> forums;
	//书籍的作者（当数据库里面存有该作者的时候我们就使用下面这个字段关联作者，便于搜索）
	private Set<Author> authors;
	//书籍作者（当数据库中不存在该作者的时候，需要用户填写作者）
	private String author;
	//买家（记录有哪些人买过这本书籍）
	//购物车购买数量（伪列）
	private Integer total;
	//备注
	private String remark;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getBookName() {
		return bookName;
	}
	public void setBookName(String bookName) {
		this.bookName = bookName;
	}
	public String getLogo() {
		return logo;
	}
	public void setLogo(String logo) {
		this.logo = logo;
	}
	public String getLogo_300() {
		return logo_300;
	}
	public void setLogo_300(String logo_300) {
		this.logo_300 = logo_300;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public double getIntegral() {
		return integral;
	}
	public void setIntegral(double integral) {
		this.integral = integral;
	}
	public Integer getPage() {
		return page;
	}
	public void setPage(Integer page) {
		this.page = page;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Integer getShow() {
		return show;
	}
	public void setShow(Integer show) {
		this.show = show;
	}
	public BookType getParent() {
		return parent;
	}
	public void setParent(BookType parent) {
		this.parent = parent;
	}
	public Date getDateLine() {
		return dateLine;
	}
	public void setDateLine(Date dateLine) {
		this.dateLine = dateLine;
	}
	public String getPrint() {
		return print;
	}
	public void setPrint(String print) {
		this.print = print;
	}
	public String getIsbn() {
		return isbn;
	}
	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}
	
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	
	public Shop getShop() {
		return shop;
	}
	public void setShop(Shop shop) {
		this.shop = shop;
	}
	public Long getRecord() {
		return record;
	}
	public void setRecord(Long record) {
		this.record = record;
	}
	public Set<SoldBook> getSoldBooks() {
		return soldBooks;
	}
	public void setSoldBooks(Set<SoldBook> soldBooks) {
		this.soldBooks = soldBooks;
	}
	public Set<Forum> getForums() {
		return forums;
	}
	public void setForums(Set<Forum> forums) {
		this.forums = forums;
	}
	public int getRecommend() {
		return recommend;
	}
	public void setRecommend(int recommend) {
		this.recommend = recommend;
	}
	public Integer getLove() {
		return love;
	}
	public void setLove(Integer love) {
		this.love = love;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public Set<Author> getAuthors() {
		return authors;
	}
	public void setAuthors(Set<Author> authors) {
		this.authors = authors;
	}
	public Integer getTotal() {
		return total;
	}
	public void setTotal(Integer total) {
		this.total = total;
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Book other = (Book) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
}
